<div class="row">
	<div class="col-xs-12 col-md-12">
		<div class="widget">
			<div class="widget-header bg-blue">
				<i class="widget-icon fa fa-arrow-down"></i>
				<span class="widget-caption">角色权限列表</span>
				<div class="widget-buttons">
					<a href="#" data-toggle="maximize">
						<i class="fa fa-expand"></i>
					</a>
					<a href="#" data-toggle="collapse">
						<i class="fa fa-minus"></i>
					</a>
					<a href="#" data-toggle="dispose">
						<i class="fa fa-times"></i>
					</a>
				</div>
			</div>
			<div class="widget-body">
				<div class="table-toolbar">
					<a href="{:url('Dlc/role/roleDetail')}" class="btn btn-primary" data-loader="App-loader" data-loadername="新增角色">
						<i class="fa fa-plus"></i>新增角色
					</a>&nbsp;&nbsp;
					 <a href="{:url('Dlc/role/authDetail')}" class="btn btn-success" data-loader="App-loader" data-loadername="编辑权限">
                       <i class="fa fa-plus"></i>编辑权限
                   </a>
					<!-- <a href="#" class="btn btn-danger" id="App-delall">
						<i class="fa fa-delicious"></i>全部删除
					</a> -->
				</div>

				<table id="App-table" class="table table-bordered table-hover">
					<thead class="bordered-darkorange">
						<tr role="row">
							<th>ID</th>
							<th>角色名</th>
							<th>权限</th>
							<th>角色人数</th>
							<th>操作</th>
						</tr>
					</thead>
					<tbody>
						{volist name="list" id="vo"}
							<tr id="item{$vo.role_id}">
								<td class=" sorting_1" width="30px">{$vo.role_id}</td>
								<td class=" ">{$vo.role_name}</td>
								<td class=" ">{$vo.auth}</td>
								<td class=" ">{$vo.count}</td>
								<td class="center ">

									<a href="{:url('Dlc/role/authEdit',array('role_id'=>$vo['role_id']))}" class="btn btn-info btn-xs" data-loader="App-loader" data-loadername="管理员列表"><i class="fa fa-list"></i>管理员列表</a>&nbsp;&nbsp;
                              		{switch name="vo.role_id" }
                              		{case value="1"}{/case}
                              		{case value="9"}
                              			<a href="{:url('Dlc/role/roleDetail',array('role_id'=>$vo['role_id']))}" class="btn btn-success btn-xs" data-loader="App-loader" data-loadername="编辑角色"><i class="fa fa-edit"></i> 编辑</a>&nbsp;&nbsp;
                              		{/case}
									{case value="4"}
										<a href="{:url('Dlc/role/roleDetail',array('role_id'=>$vo['role_id']))}" class="btn btn-success btn-xs" data-loader="App-loader" data-loadername="编辑角色"><i class="fa fa-edit"></i> 编辑</a>&nbsp;&nbsp;
									{/case}
									{default /}
									<a href="{:url('Dlc/role/roleDetail',array('role_id'=>$vo['role_id']))}" class="btn btn-success btn-xs" data-loader="App-loader" data-loadername="编辑角色"><i class="fa fa-edit"></i> 编辑</a>&nbsp;&nbsp;
									{if condition="!in_array($vo['role_id'],[1,2,3])"}
										<a href="{:url('/Dlc/role/roleDel',array('role_id'=>$vo['role_id']))}" class="btn btn-danger btn-xs" data-type = "del" data-ajax="{:url('/Dlc/role/roleDel/',array('role_id'=>$vo['role_id']))}"><i class="fa fa-trash-o"></i> 删除</a>
									{/if}
									{/switch}
								</td>
							</tr>
						{/volist}

					</tbody>
				</table>
				<div class="row DTTTFooter">
                {$page}
				</div>
			</div>
		</div>
	</div>
</div>
<!--面包屑导航封装-->
<div id="tmpbread" style="display: none;">{$breadhtml}</div>
<script type="text/javascript">
	setBread($('#tmpbread').html());
</script>
<!--/面包屑导航封装-->
<!--全选特效封装/全部删除-->
<script type="text/javascript">
	//全选
	var checkall=$('#App-table .App-checkall');
	var checks=$('#App-table .App-check');
	var trs=$('#App-table tbody tr');
	$(checkall).on('click',function(){
		if($(this).is(":checked")){
			$(checks).prop("checked","checked");
		}else{
			$(checks).removeAttr("checked");
		}
	});
	$(trs).on('click',function(){
		var c=$(this).find("input[type=checkbox]");
		if($(c).is(":checked")){
			$(c).removeAttr("checked");
		}else{
			$(c).prop("checked","checked");
		}
	});
	//全删
	$('#App-delall').on('click',function(){
		var checks=$(".App-check:checked");
		var chk='';
		$(checks).each(function(){
			chk+=$(this).val()+',';
		});
		if(!chk){
			$.App.alert('danger','请选择要删除的项目！');
			return false;
		}
		var toajax="{:url('/Dlc/role/roleDel')}"+"/id/"+chk;
		var funok=function(){
			var callok=function(){
				//成功删除后刷新
				$('#refresh-toggler').trigger('click');
				return false;
			};
			var callerr=function(){
				//拦截错误
				return false;
			};
			$.App.ajax('post',toajax,'nodata',callok,callerr);
		}
		$.App.confirm("确认要删除吗？",funok);
	});
</script>
<!--/全选特效封装-->